package com.java.mytest_ysy.c.demo2;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Objects;
@Data
@NoArgsConstructor
@AllArgsConstructor
//public class Ball implements Comparable<Ball>{
public class Ball{
    private String color;
    private int number;
    @Override
    public int hashCode() {
        return Objects.hash(color, number);
    }
    @Override
    public String toString(){
        return color+":"+number;
    }

    /*@Override
    /o->比较者
    public int compareTo(Ball o) {
        if (o.color.equals("红球") && getColor().equals("蓝球")) {
            return 1;
        } else if (color.equals("红球") && o.getColor().equals("红球")) {
            return number - o.getNumber();
        }
        return 0;
    }*/
}
